﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using Public;

namespace Dal
{
    public class Setting
    {
        //EXEC sp_helpfile;
        public static DataTable GETDBSIZE(string strCon)
        {
            DataTable dt = new DataTable();
            dt.Locale = CultureInfo.InvariantCulture;

            try
            {
                dt = SqlHelper.ExecuteDataTable(DataProtector.DecryptString(strCon), CommandType.Text, "EXEC sp_helpfile");
            }
            catch
            {
                throw;
            }
            return dt;
        }

        public static int DeleteLog(string strCon)
        {
            int rtn = 0;
            string str = DataProtector.DecryptString(strCon);
            str = str.Split('=')[2];
            str = str.Split(';')[0];
            SqlParameter[] pars = new SqlParameter[1];
            pars[0] = new SqlParameter("@dbname", SqlDbType.NVarChar, 50);
            pars[0].Value = str;
            try
            {
                SqlHelper.ExecuteNonQuery(DataProtector.DecryptString(strCon), CommandType.StoredProcedure, "SP_Setting_DeleteLog", pars);
            }
            catch
            {
                throw;
            }
            return rtn;

            
        }
    }
}
